<!doctype html>
<html>

<head>
    <meta charset="UTF-8">
    <title></title>
    <meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
    <script src="__FRONT__/dist/lib/jquery-2.1.4.js"></script>
    <link rel="stylesheet" href="__FRONT__/css/wakeup.css" />
    <link rel="stylesheet" href="__FRONT__/css/iconfont.css" />
    <script type="text/javascript" src="__FRONT__/js/common.js"></script>
    <link rel="stylesheet" type="text/css" href="__FRONT__/dist/lib/weui.min.css">
    <link rel="stylesheet" type="text/css" href="__FRONT__/dist/css/jquery-weui.min.css">
    <script src="__FRONT__/dist/js/jquery-weui.js"></script>
    <script>
        $(function () {
            $(document).on('click', '.login-code', function () {
                var username = $('input[name="username"]').val();
                var password = $('input[name="password"]').val();
                if (!username || !password) {
                    // alert(1);
                    $.toast('用户名或密码为空','cancel');
                    return;
                }

                var myreg = /^(((13[0-9]{1})|(15[0-9]{1})|(18[0-9]{1}))+\d{8})$/;
                if (!myreg.test(username)) {
                    $.toast('请输入正确的手机号码','cancel');
                    return false;
                }
                if (password.length < 6) {
                    $.toast('密码不能小于六位数','cancel');
                    return;
                }

                $.post("{:url('user/checkLogin')}",{'username': username, 'password': password},function(data){
                    if (data.code==1) {
                        $.toast(data.msg,'cancel');
                    } else {
                        $.toast(data.msg);
                        location.href = '{:url("user/index")}'
                    }
                })
            })
            /* $(document).on('click', '.send-code', function () {
                 var username = $(' input[name="username"]').val();
                 option = {
                     'btnElement': $('.send-code'),
                     'showElement': $('.js-timer'),
                     'btnTips': '<a class="send-code">重新获取验证码</a>',
                     'successCallback': function (ret, message) {
                         if (ret == '0') {
                             util.toast(message);
                             $('.js-sendcode').hide();
                             $('.js-codeverify').show();
                         } else {
                             util.toast(message);
                             $('.js-sendcode').show();
                             $('.js-codeverify').hide();
                             return;
                         }
                     }
                 };
                 util.sendCode(username, option);
             });*/
        });
     </script>
</head>

<body>
<div class='contrner'>
    <div class="bg">
        <img id='bgimg' src="__FRONT__/img/loginbg.jpg" alt="" /><br />
    </div>
    <div class='center'>
        <div class='center-top'>
            <ul>
                <li class = 'username'>
                    <div>
                        <i class="iconfont icon-yonghu"><span>丨账号</span>
                        </i>
                        <!--<i>丨账号</i>-->
                        <input type="text" name='username' value="" />
                    </div>
                </li>
                <li class = 'username password'>
                    <div>
                        <i class="iconfont icon-mima_"><span>丨密码</span>
                        </i>
                        <!--<i>丨账号</i>-->
                        <input type="password" name='password' value="" />
                    </div>
                </li>
            </ul>
        </div>
        <div class='center-bottom'>
            <div class='remember'><input type="checkbox" /><span>&nbsp&nbsp记住登录密码</span></div>
            <div class='login-btn'>
                <button type="button" class="login-code">登　录</button>
            </div>
            <div class="info">
                <ul>
                    <li><a href="{:url('user/reg')}">立即注册</a><a href="{:url('user/repwd')}">忘记密码？</a></li>
                </ul>
            </div>
        </div>
    </div>
</div>



</body>
</html>